package Interfaz;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;


/**
 * CU005 - Modificar competencia deportiva (modalidad Eliminatoria Simple)
 * @author 
 */
public class CU005_elim_simple {

	protected Shell shlNueva_eliminatoria;
	private Text text;
	private Text text_1;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			CU005_elim_simple window = new CU005_elim_simple();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		
		// Centrar ventana
		Monitor primary = display.getPrimaryMonitor();
		Rectangle bounds = primary.getBounds();
		Rectangle rect = shlNueva_eliminatoria.getBounds();
		int x = bounds.x + (bounds.width - rect.width) / 2;
		int y = bounds.y + (bounds.height - rect.height) / 2;	    
		shlNueva_eliminatoria.setLocation(x, y);
		
		Button button = new Button(shlNueva_eliminatoria, SWT.NONE);
		button.setText("Cancelar");
		button.setBounds(314, 131, 108, 32);
		
		Button btnGuardar = new Button(shlNueva_eliminatoria, SWT.NONE);
		btnGuardar.setText("Guardar");
		btnGuardar.setBounds(182, 131, 108, 32);
		
		Button button_2 = new Button(shlNueva_eliminatoria, SWT.NONE);
		button_2.setText("<< Anterior");
		button_2.setBounds(50, 131, 108, 32);
		
		shlNueva_eliminatoria.open();
		shlNueva_eliminatoria.layout();
		while (!shlNueva_eliminatoria.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shlNueva_eliminatoria = new Shell(SWT.CLOSE | SWT.TITLE | SWT.MIN);
		shlNueva_eliminatoria.setMinimumSize(new Point(132, 28));
		shlNueva_eliminatoria.setSize(450, 214);
		shlNueva_eliminatoria.setText("Modalidad Eliminatoria Simple");
		
		Label label = new Label(shlNueva_eliminatoria, SWT.NONE);
		label.setText("Forma de puntuaci\u00F3n:");
		label.setBounds(10, 13, 116, 15);
		
		final Label label_2 = new Label(shlNueva_eliminatoria, SWT.NONE);
		label_2.setText("Puntos por ausencia:");
		label_2.setEnabled(false);
		label_2.setBounds(140, 81, 110, 15);
		
		final Label label_1 = new Label(shlNueva_eliminatoria, SWT.NONE);
		label_1.setText("Cantidad m\u00E1xima:");
		label_1.setEnabled(false);
		label_1.setBounds(140, 41, 96, 15);
		
		text = new Text(shlNueva_eliminatoria, SWT.BORDER);
		text.setEnabled(false);
		text.setBounds(242, 38, 76, 21);
		
		text_1 = new Text(shlNueva_eliminatoria, SWT.BORDER);
		text_1.setEnabled(false);
		text_1.setBounds(256, 78, 76, 21);
		
		final Button button = new Button(shlNueva_eliminatoria, SWT.RADIO);
		button.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				label_1.setEnabled(true);
				text.setEnabled(true);
				label_2.setEnabled(false);
				text_1.setEnabled(false);
			}
		});
		button.setText("Sets");
		button.setBounds(10, 40, 42, 16);
		
		Button button_1 = new Button(shlNueva_eliminatoria, SWT.RADIO);
		button_1.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent e) {
				label_1.setEnabled(false);
				text.setEnabled(false);
				label_2.setEnabled(true);
				text_1.setEnabled(true);
			}
		});
		button_1.setText("Puntuaci\u00F3n");
		button_1.setBounds(10, 80, 90, 16);

	}

}
